<template>
  <div class="parentWrapper">
    <Parent :parentData="parentData.parent" v-if="parentData.parent"></Parent>
    <div class="info">
      <div class="name">
        {{parentData.user.nickname}}
        <div class="date">{{parentData.create_date.split("T")[0]}}</div>
      </div>

      <div class="huifu" @click="reply">回复</div>
    </div>
    <div class="mainContent">{{parentData.content }}</div>
  </div>
</template>

<script>
// 引入事件总线
import Bus from "../util/Bus";

export default {
  name: "Parent",
  props: ["parentData"],
  methods: {
    reply() {
      Bus.$emit("reply", this.parentData.id);
    },
  },
};
</script>

<style lang="less" scoped>
.parentWrapper {
  border: 1px solid #888;
  padding: 10/360 * 100vw;
  .info {
    display: flex;
    align-items: center;
    .avatar {
      width: 36/360 * 100vw;
      height: 36/360 * 100vw;
      object-fit: cover;
      border-radius: 50%;
    }
    .name {
      flex: 1;
      padding-left: 10/360 * 100vw;
      padding-top: 10/360 * 100vw;
      font-size: 16/360 * 100vw;
      .date {
        margin-top: 5/360 * 100vw;
        font-size: 12/360 * 100vw;
        color: #bbb;
      }
    }
    .huifu {
      font-size: 14/360 * 100vw;
      color: #888;
    }
  }
  .mainContent {
    padding: 10/360 * 100vw;
    color: #444;
  }
}
</style>